Repository navigation
Dead PR: loopback.token option.defaultTokenKeys - #1347
OwenBrotherwood wants to merge 30 commits into
Conversation
|
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
|
@slnode ok to test |
|
@OwenBrotherwood Thank you for the pull request.
|
|
@bajtos
Any comments about the option name noConcat ? I couldn't think of a better one at the time Notes:
Beginners help for test (my first guesses before googling)
|
Perhaps Regarding the unit-tests, test/access-token.test.js is the best place where to add the new test. Take a look at "should populate req.token from the query string" for an example. You will need to modify Let me know how far you get and if there is anything else I can do to help you along the way. |
|
|
@bajtos I think when everything is ok, it might be nicer to reject this push and I can create a "nicer" push: to many commits for my taste |
|
@bajtos |
|
@OwenBrotherwood loopback tests have this ugly quirk that you cannot run a single test file, you must include The easiest way to run a subset of unit-tests is to use the
You can clean up the commit history by running |
There was a problem hiding this comment.
Please keep the line length at 80 characters max.
|
@OwenBrotherwood Please add another test to verify that the default token keys are not added. I.e. send a request that would be authorized with @ritch I feel the option name |
There was a problem hiding this comment.
I would suggest a different option name:
searchDefaultTokenKeys: falseThere was a problem hiding this comment.
I agree, I was getting tired of the other name
|
@bajtos
I now have the same test: I will now try and make sure that the user's use of a model is allowed by allowing the code to generate 200 or 401 instead of the assert test. |
@OwenBrotherwood Just call a different URL path instead of |
There was a problem hiding this comment.
We usually use a simpler check options.searchDefaultTokenKeys !== false. It works well for true, false and undefined, even though it behaves differently for edge cases like null or non-boolean value.
There was a problem hiding this comment.
I will use !== false so that it the same as is currently used for this type of test
|
@OwenBrotherwood To be honest, I am quite confused about the direction you are taking and don't know what's the best way how I can help you to move forward. Please let me know if there is anything else to answer or explain in addition to my comments above. |
|
@bajtos The current status is, there is a reasonably alteration to support options.searchDefaultTokenKeys https://github.com/OwenBrotherwood/loopback/blob/2bef4d861bd70ac823c62cfe4580af598d956d83/common/models/access-token.js?#L171-176 And of course a tests to ensure that the api loopback.token(options) is tested all the way from the call to the api to what is expected as the result. |
OK, thanks for letting me know.
That's a good idea! 👍 |
Edit:
Pull request closed #1347 (comment)
Allow full control of which methods and values are used to obtain Access Token.
Requires specific methods and values as option
Example:
Only allow headers as source of Access Token from X-Access-Token and authorization
Signed-off-by: Owen Brotherwood owen@brotherwood.biz
Edit:
#1347 (comment) option name change from options.defaultTokenKeys to options.searchDefaultTokenKeys